<template>
    <div>
      {{$store.state.count}}{{$store.getters.type}}
      <button @click='add(30)'>增加</button>
      <button @click='minus'>减少</button>
      <button @click='changeCount(1)'>6666</button>
    </div>
</template>
<script>
// @ is an alias to /src
import {mapMutations,mapActions} from 'vuex'
export default {
    name: 'XXX',
    data() {
        return {
        
        }
    },
    methods: {
      ...mapMutations(['changeCount','changeA']),
      // ...mapMutations({
      //   add:'changeCount'
      // }),
      ...mapActions({
        add:'changeCount'
      }),
      // add(){
      //   // this.$store.state.count++
      //   // commit() 会默认去 mutations查找到对应的函数并且执行
      //   // this.$store.commit('changeCount',100)
      //   // this.$store.commit({type:'changeCount',num:100})
      //   this.$store.dispatch('changeCount',100,200)
      // },
      minus(){
        // this.$store.state.count--
        // this.$store.commit('changeCount',-50)
        this.$store.dispatch('changeCount',-100,200)
        this.changeA(1,2,3,4)
      }
    },
    components: {
        
    }
}
</script>
<style lang="less">

</style>